﻿using System;
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace MultiLaguage.Test
{
    public class MultiLaguageFacts
    {
        public static string _CharsetOne = "en_US";
        public static string _CharsetSecond = "zh_CN";
        public static string baseDirectory = AppContext.BaseDirectory;
        public class Test
        {

        }

        [Fact]
        public void languageBind()
        {
            string[] arrayPath = baseDirectory.Split(@"bin");
            string resourcePath = arrayPath[0] + @"languageresources";
            MultiLaguagePower.languageBind();
            MultiLaguagePower.languageBind(resourcePath);
            MultiLaguagePower.languageBind(resourcePath, _CharsetOne);
            MultiLaguagePower.languageBind(resourcePath, _CharsetSecond);
        }

        [Fact]
        public void GetUsValue()
        {
            string[] arrayPath = baseDirectory.Split(@"bin");
            string resourcePath = arrayPath[0] + @"languageresources";
            MultiLaguagePower.languageBind(resourcePath, _CharsetOne);
            GetResourcesValue getResourcesValue = new GetResourcesValue();
            Assert.Equal("ID IS NOT EXIST!", getResourcesValue.GetStringValue("010"));
        }

        [Fact]
        public void GetCnValue()
        {
            string[] arrayPath = baseDirectory.Split(@"bin");
            string resourcePath = arrayPath[0] + @"languageresources";
            MultiLaguagePower.languageBind(resourcePath, _CharsetSecond);
            GetResourcesValue getResourcesValue = new GetResourcesValue();
            Assert.Equal("用户id不存在!", getResourcesValue.GetStringValue("010"));
        }


    }
}
